package team.archai.nexus.boot.platform.modules.system.dto.extend;

import lombok.Getter;
import lombok.Setter;
import team.archai.nexus.boot.platform.basics.entity.BasicsEntity;
import team.archai.nexus.boot.platform.modules.system.vo.MenuTree;
import team.archai.nexus.boot.platform.modules.system.vo.RouterMenuTree;
import team.archai.nexus.boot.tool.BeanUtils;

import java.util.function.Function;

/**
 * @program: tiny-dust-boot-build
 * @description: tree 和bean转换
 * @author: lishibin
 * @create: 2020-09-20 10:56
 **/
@Getter
@Setter
public class TreeTrans<E extends BasicsEntity> {

    public Function<E, MenuTree> entity2MenuTree = entity -> {
        MenuTree menuTree = new MenuTree();
        menuTree.setId(entity.getId());
        BeanUtils.copyProperties(entity, menuTree);
        return menuTree;
    };

}
